home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- 'On Error Resume Next
-
- Dim oArgs
- Set oArgs = WScript.Arguments
- If oArgs.Count <> 1 Then
- ErrorExit "Require the 'virtual-dir-name' parameter"
- End If
-
- Dim sComputer, sVirtualDir, oVDir
- sComputer = "localhost"
- sVirtualDir = oArgs(0)
-
- DebugLog "Check if virtual dir exists"
- Set oVDir = GetObject("IIS://" & sComputer & "/W3SVC/1/Root/" & sVirtualDir)
- If Err.Number = 0 Then
- ' Virtual dir exists, so delete.
- Dim oRoot, oSite
- Set oSite = GetObject("IIS://" & sComputer & "/W3SVC/1")
-
- Set oRoot = oSite.GetObject( "IIsWebVirtualDir", "Root")
-
- DebugLog "Delete virtual dir"
- oRoot.Delete "IIsWebVirtualDir", sVirtualDir
- End If
-
-
- Sub DebugLog(sMsg)
- 'WScript.Echo sMsg
- End Sub
-
-
- ' Displays a message to the user then exits with error code.
- Sub ErrorExit(sMsg)
- On Error Resume Next
- WScript.Echo sMsg
- WScript.Quit 1
- End Sub